package wiki.generic.iotests;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import wiki.generic.io.GenericDataWriter;
/**
 * 
 * @author <p><strong>JwTeam</strong></p> 
 *
 */
public class ConcreteDataMapWriter implements GenericDataWriter{

	@Override
	public void saveDataMap(HashMap<String, String> dataMap,
			String destinationfile) {
	
		File file=new File(destinationfile);
		
		try {
			BufferedWriter writer=new BufferedWriter(new FileWriter(file));
			Set<String> keyset=dataMap.keySet();
			for (Iterator<String> iterator = keyset.iterator(); iterator.hasNext();) {
				String buf= iterator.next();
				writer.write(buf+"$$||$$"+dataMap.get(buf)+"\n");
			}
			
			writer.close();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

	
	
}
